<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>    
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<c:set var="contextPath" value="${pageContext.request.contextPath}" />

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.1//EN" "http://www.wapforum.org/DTD/xhtml-mobile11.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width, target-densitydpi=medium-dpi" />
	<title>인권과 평화의 대학 - 성공회대학교</title>
	<link rel="stylesheet" href="${contextPath}/css/common/layout.css" type="text/css" />
	<script type="text/javascript" src="${contextPath}/js/common/lib/jquery-1.6.4.js"></script>
	<script type="text/javascript" src="${contextPath}/js/common/menu.js"></script>
	<link rel="stylesheet" href="${contextPath}/css/etc/used_view.css" type="text/css" />
	<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-32515688-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head>
<body> 
	
	<!-- 상단영역 -->
	<jsp:include page="../common/header.jsp" />
	
	<!-- 가운데영역 -->
	<div id="center">
		
		<!-- 공통 네비게이션 -->
		<h2>
			<span class="nav_step">  
				중고장터
			</span>
		</h2>
		<!-- 공통 부분 -->
		
		<div id="content_zone">
			<ul>
				<li class="title">제목 : ${used.title}</li>
				<li class="writer">거래물품 : ${used.goodsName}</li>
				<li class="writer">가격 : ${used.price}</li>
				<li class="writer">등록자 : ${used.writer}</li>
				<li class="date">등록일 : ${used.regDate}</li>
				<li class="content">
					<div class="imgZone">
						<img src="http://cfile21.uf.tistory.com/image/165ACB4B4FA396FD30AD56" alt="거래물품 이미지" />
					</div>
					<p>${used.comment}</p>
				</li>
			</ul> 
		</div>
		
		<c:if test="${commentList != null}">
			<dl id="commentList">
				<dt class="commentSize">
					댓글
				</dt>
				<dd>
					<c:forEach items="${commentList}" var="commentList">
						<dl class="comment">
							<dt>
								<span class="writer">${commentList.writer}</span> 
								<span class="reg_date">${commentList.regDate}</span>
								<a class="comment_del" href="#"><img src="${contextPath}/img/del.jpg" alt="댓글삭제" /></a>		
							</dt>
							<dd> 
								${commentList.comment}					
							</dd>
						</dl> 
					</c:forEach>
				</dd>
			</dl>
		</c:if>
		
		<form action="${contextPath}/etc/comment_write.do" method="post">
			<input type="hidden" id="articleNo" name="articleNo" value="${articleNo}" />
			<input type="hidden" id="pageNum" name="pageNum" value="${pageNum}" />
			<dl id="comment_write">
				<dd class="line"><span>이름 :</span><input type="text" class="inputText" id="writer" name="writer" /></dd>
				<c:choose>
					<c:when test="${param.ec == 11}">
						<dd class="error">이름을 입력하세요.</dd>						
					</c:when>
					<c:when test="${param.ec == 12}">
						<dd class="error">이름의 길이는 2~8사이입니다.</dd>						
					</c:when>
				</c:choose>
				<dd class="line"><span>비밀번호 :</span><input type="password" class="inputText" id="password" name="password" /></dd>
				<c:choose>
					<c:when test="${param.ec == 21}">
						<dd class="error">비밀번호를 입력하세요.</dd>						
					</c:when>
					<c:when test="${param.ec == 22}">
						<dd class="error">비밀번호의 길이는 4~12사이입니다.</dd>						
					</c:when>
				</c:choose>
				<dd>
					<textarea id="comment" name="comment"></textarea>
				</dd>
				<c:choose>
					<c:when test="${param.ec == 31}">
						<dd class="error">내용를 입력하세요.</dd>						
					</c:when>
				</c:choose>
				<dd class="submitBt">
					<input type="submit" value="확인" /> 
				</dd>
			</dl>
		</form>
		
		<a id="go_list" href="${contextPath}/etc/used_list.do?pageNum=${pageNum}">목록</a>
		
	</div> 
	
	<!-- 하단영역 -->
	<jsp:include page="../common/footer.jsp" />
	
</body>
</html>